package com.jbit.service.impl;

import com.jbit.dto.DmSchedulerSeatPrice;
import com.jbit.mapper.DmSchedulerSeatPriceMapper;
import com.jbit.service.DmScheduleSeatPriceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class DmScheduleSeatPriceServiceImpl implements DmScheduleSeatPriceService {
    @Resource
    private DmSchedulerSeatPriceMapper dmScheduleSeatPriceMapper;
    @Override
    public List<DmSchedulerSeatPrice> querySeatPriceByScheduleId(Integer scheduleId) {
        List<DmSchedulerSeatPrice> schedulerSeatPriceList = dmScheduleSeatPriceMapper.querySeatPriceByScheduleId(scheduleId);
        for (DmSchedulerSeatPrice dmSchedulerSeatPrice : schedulerSeatPriceList) {
            if (dmSchedulerSeatPrice.getSeatNum() > 0){
                dmSchedulerSeatPrice.setIsHaveSeat(1);
            }else{
                dmSchedulerSeatPrice.setIsHaveSeat(0);
            }
        }
        return schedulerSeatPriceList;
    }
}

